import React, { Component } from "react";
import Child1 from "./Child1";
import Child2 from "./Child2";

class App extends Component {
  state = {
    count: 0,
  };

  fn(num) {
    this.setState({
      count: num,
    });
  }

  render() {
    return (
      <>
        <h3>状态提升</h3>
        <Child1 onGetCount={this.fn.bind(this)} />
        <Child2 count={this.state.count} />
      </>
    );
  }
}

export default App;
